<?php

use think\migration\Migrator;
use think\migration\db\Column;

class TopicUserDay extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
//        $table = $this->table('topic_user_day', ['comment' => '每日做题记录']);
//        $table
//            ->addColumn('user_id', 'integer', array('limit' => 30, 'default' => 0, 'comment' => '练习人'))
//            ->addColumn('unit_id', 'integer', array('limit' => 30, 'default' => 0, 'comment' => '所属单位'))
//            ->addColumn('date_of', 'string', array('limit' => 220, 'null' => true, 'comment' => '日期'))
//            ->addTimestamps()
//            ->addSoftDelete()
//            ->create();
//
//
//        $table = $this->table('topic_exercise_log', ['comment' => '记录表']);
//        $table
//            ->addColumn('topic_user_day_id', 'integer', array('limit' => 30, 'default' => 0, 'comment' => '每日做题记录id'))
//            ->save();

        $table = $this->table('monthly_test', ['comment' => '月考表']);
        $table
            ->addColumn('unit_id', 'integer', array('limit' => 30, 'default' => 0, 'comment' => '所属单位'))
            ->save();
    }
}
